package com.gonsin.ta.logic.parse.serialize;

import com.gonsin.ta.logic.enums.ConditionTypeEnum;
import com.gonsin.ta.logic.parse.condition.Executable;
import com.gonsin.ta.logic.parse.condition.RunCondition;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

@Data
public class RunConditionSerial extends ConditionSerial {

    private List<TaDeserializable> executableList = new ArrayList<>();

    private ConditionTypeEnum conditionType = ConditionTypeEnum.RUN;


    @Override
    public Executable toExecutable(DeserializeContext deserializeContext) {
        RunCondition runCondition = new RunCondition();
        runCondition.setConditionId(this.getConditionId());
        for(TaDeserializable taDeserializable : executableList){
            runCondition.getExecutableList().add(taDeserializable.toExecutable(deserializeContext));
        }
        return runCondition;
    }
}
